package com.bocloud.cmp.entity.resource;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
 * 数据存储实体类
 * 
 * @author dmw
 *
 */
@Table("data_store")
public class DataStore extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id;
	@Column("vendor_id")
	private Long vendorId; // 云供应商ID
	@IgnoreAll
	private String vendorName; // 云供应商名称
	@Column("gmt_expired")
	@JsonSerialize(using = DateSerializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date gmtExpired;// 过期时间
	@Column("capacity")
	private Long capacity;
	@Column("free_space")
	private Long freeSpace;
	@Column("vdc_id")
	private Long vdcId;
	@Column("type")
	private String type;
	@Column("path")
	private String path;
	@Column("host_num")
	private Integer hostNum;
	@Column("vm_num")
	private Integer vmNum;// 存储管理的虚拟机数量
	@IgnoreAll
	private Integer vmNumUm;// 存储未管理的虚拟机数量
	@Column("template_num")
	private Integer templateNum;// 存储下的模板数量
	@Column("store_val")
	private String storeVal;// 存储value

	/**
	 * @return the vdcId
	 */
	public Long getVdcId() {
		return vdcId;
	}

	/**
	 * @param vdcId
	 *            the vdcId to set
	 */
	public void setVdcId(Long vdcId) {
		this.vdcId = vdcId;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the vendorId
	 */
	public Long getVendorId() {
		return vendorId;
	}

	/**
	 * @param vendorId
	 *            the vendorId to set
	 */
	public void setVendorId(Long vendorId) {
		this.vendorId = vendorId;
	}

	/**
	 * @return the vendorName
	 */
	public String getVendorName() {
		return vendorName;
	}

	/**
	 * @param vendorName
	 *            the vendorName to set
	 */
	public void setVendorName(String vendorName) {
		this.vendorName = vendorName;
	}

	/**
	 * @return the gmtExpired
	 */
	public Date getGmtExpired() {
		return gmtExpired;
	}

	/**
	 * @param gmtExpired
	 *            the gmtExpired to set
	 */
	public void setGmtExpired(Date gmtExpired) {
		this.gmtExpired = gmtExpired;
	}

	/**
	 * @return the capacity
	 */
	public Long getCapacity() {
		return capacity;
	}

	/**
	 * @param capacity
	 *            the capacity to set
	 */
	public void setCapacity(Long capacity) {
		this.capacity = capacity;
	}

	/**
	 * @return the freeSpace
	 */
	public Long getFreeSpace() {
		return freeSpace;
	}

	/**
	 * @param freeSpace
	 *            the freeSpace to set
	 */
	public void setFreeSpace(Long freeSpace) {
		this.freeSpace = freeSpace;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * @return the path
	 */
	public String getPath() {
		return path;
	}

	/**
	 * @param path
	 *            the path to set
	 */
	public void setPath(String path) {
		this.path = path;
	}

	/**
	 * @return the hostNum
	 */
	public Integer getHostNum() {
		return hostNum;
	}

	/**
	 * @param hostNum
	 *            the hostNum to set
	 */
	public void setHostNum(Integer hostNum) {
		this.hostNum = hostNum;
	}

	/**
	 * @return the vmNum
	 */
	public Integer getVmNum() {
		return vmNum;
	}

	/**
	 * @param vmNum
	 *            the vmNum to set
	 */
	public void setVmNum(Integer vmNum) {
		this.vmNum = vmNum;
	}

	/**
	 * @return the vmNumUm
	 */
	public Integer getVmNumUm() {
		return vmNumUm;
	}

	/**
	 * @param vmNumUm
	 *            the vmNumUm to set
	 */
	public void setVmNumUm(Integer vmNumUm) {
		this.vmNumUm = vmNumUm;
	}

	/**
	 * @return the templateNum
	 */
	public Integer getTemplateNum() {
		return templateNum;
	}

	/**
	 * @param templateNum
	 *            the templateNum to set
	 */
	public void setTemplateNum(Integer templateNum) {
		this.templateNum = templateNum;
	}

	/**
	 * @return the storeVal
	 */
	public String getStoreVal() {
		return storeVal;
	}

	/**
	 * @param storeVal
	 *            the storeVal to set
	 */
	public void setStoreVal(String storeVal) {
		this.storeVal = storeVal;
	}

	/**
	 * @param createrId
	 * @param ownerId
	 * @param menderId
	 * @param id
	 * @param vendorId
	 * @param vendorName
	 * @param gmtExpired
	 * @param capacity
	 * @param freeSpace
	 * @param type
	 */
	public DataStore(Long createrId, Long ownerId, Long menderId, Long id, Long vendorId, String vendorName,
			Date gmtExpired, Long capacity, Long freeSpace, String type, String path, Integer hostNum, Integer vmNum,
			Integer templateNum, String storeVal) {
		super(createrId, ownerId, menderId);
		this.id = id;
		this.vendorId = vendorId;
		this.vendorName = vendorName;
		this.gmtExpired = gmtExpired;
		this.capacity = capacity;
		this.freeSpace = freeSpace;
		this.type = type;
		this.path = path;
		this.hostNum = hostNum;
		this.vmNum = vmNum;
		this.templateNum = templateNum;
		this.storeVal = storeVal;
	}

	/**
	 * 
	 */
	public DataStore() {
		super();
	}

	public DataStore(Long createrId, Long ownerId, Long menderId, String name, String status, Boolean deleted,
			String props, String remark) {
		super(createrId, ownerId, menderId, name, status, deleted, props, remark);
	}

	public DataStore(Long createrId, Long ownerId, Long menderId) {
		super(createrId, ownerId, menderId);
	}

	public void preSave(Long createrId, Long menderId, Long vendorId, Long vdcId) {
		this.setCreaterId(createrId);
		this.setMenderId(menderId);
		this.setVendorId(vendorId);
		this.setVdcId(vdcId);
	}

}
